Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve thread safety #130

Merged
merged 3 commits into from
Oct 15, 2021
Merged

Improve thread safety #130

merged 3 commits into from
Oct 15, 2021

Conversation

pash-slack
Copy link

@pash-slack pash-slack commented May 6, 2020

Description

Every so often we see a CME due to the underlying implementation of List being used is ArrayList.

11:25:37  java.util.ConcurrentModificationException
11:25:37  	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
11:25:37  	at java.util.ArrayList$Itr.next(ArrayList.java:859)
11:25:37  	at hudson.plugins.s3.S3Profile.downloadAll(S3Profile.java:240)
11:25:37  	at hudson.plugins.s3.S3CopyArtifact.perform(S3CopyArtifact.java:270)
11:25:37  	at hudson.plugins.s3.S3CopyArtifact.perform(S3CopyArtifact.java:242)
11:25:37  	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
  • Modifying the implementation so that a thread-safe variant of the List is used in place.
  • I used a CopyOnWriteArrayList and that should prevent the CME from being thrown. Ideally an alternative Concurrent collection or synchronization around the original ArrayList would be done. However, this seems to be the least intrusive way of getting around the exception being thrown.

Testing

  • Tested this change locally on our own Jenkins instance and things were running fine.
  • The CI running within Github is somehow not happy about the versions of dependencies being used and seems to be an error not directly related to my change.

@msabastian
Copy link

msabastian commented Jun 29, 2020

@dougm
@d6y
@mikewatt
@dmbeer
@jenkinsadmin

could I get someone to review this PR please? 🙇‍♀️

@msabastian
Copy link

@dougm
@d6y
@mikewatt
@dmbeer
@jenkinsadmin

could I get someone to review this PR please? 🙇‍♀️

@alecharp alecharp mentioned this pull request Nov 23, 2020
@msabastian
Copy link

@alecharp Can we go ahead merge this PR?

@pash-slack pash-slack closed this Apr 26, 2021
@pash-slack pash-slack reopened this Apr 26, 2021
@rsandell rsandell added the bug label Oct 15, 2021
@rsandell rsandell merged commit e97777a into jenkinsci:master Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants